import {Names} from "./storesName";
import {defineStore} from 'pinia'

type UserInfo = {
  token: string,
  userInfo: any,
  loading: boolean
}

export const useUserInfo = defineStore(Names.ACCOUNT, {
  state: (): UserInfo => {
    return {
      token: '',
      userInfo: {},
      loading: false
    }
  },
  getters: {},
  actions: {},
  persist: {
    enabled: true,
    strategies: [
      {
        storage: localStorage,
        // paths: ['token'], // paths 是一个数组，如果写了 就会只存储 token 变量，当然也可以写多个。
      }
    ]
  }
})